package com.rickie;

import com.alibaba.cola.catchlog.CatchAndLog;
import com.alibaba.cola.dto.SingleResponse;
import com.rickie.api.ICargoBookingService;
import com.rickie.executor.CargoBookingCmdExe;
import com.rickie.executor.HandlingActivityUpdateCmdExe;
import com.rickie.executor.query.CargoByBookingIdQryExe;
import com.rickie.dto.command.CargoBookCmd;
import com.rickie.dto.command.HandlingActivityUpdateCmd;
import com.rickie.dto.data.CargoDTO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author rickie
 * @version 1.0.0
 * @ClassName CargoServiceImpl.java
 * @Description http预订service
 * @createTime 2021年06月14日 01:05:00
 */
@Service
@CatchAndLog
public class CargoBookingServiceImpl implements ICargoBookingService {
    @Resource
    private CargoBookingCmdExe cargoBookingCmdExe;

    @Resource
    private CargoByBookingIdQryExe cargoByBookingIdQryExe;

    @Resource
    private HandlingActivityUpdateCmdExe handlingActivityUpdateCmdExe;

    @Override
    public SingleResponse<String> bookCargo(CargoBookCmd cargoBookCmd) {
        return cargoBookingCmdExe.execute(cargoBookCmd);
    }

    @Override
    public SingleResponse<CargoDTO> findByBookingId(String bookingId) {
        return cargoByBookingIdQryExe.execute(bookingId);
    }

    @Override
    public SingleResponse<String> updateByCargoHandledEvent(HandlingActivityUpdateCmd cmd) {
        return handlingActivityUpdateCmdExe.execute(cmd);
    }
}
